﻿using System;
using System.Collections.Generic;
using System.Reflection;

namespace RuoVea.DynamicWebApi;

/// <summary>
/// 
/// </summary>
public static class AppConsts
{
    /// <summary>
    /// 
    /// </summary>
    public static string DefaultHttpVerb { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public static string DefaultAreaName { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public static string DefaultApiPreFix { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public static List<string> ControllerPostfixes { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public static List<string> ActionPostfixes { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public static List<Type> FormBodyBindingIgnoredTypes { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public static Dictionary<string, string> HttpVerbs { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public static Func<string, string> GetRestFulActionName { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public static Dictionary<Assembly, AssemblyDynamicWebApiOptions> AssemblyDynamicWebApiOptions { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public static List<string> RemovePrefix { get; set; }

    static AppConsts()
    {
        HttpVerbs = new Dictionary<string, string>()
        {
            ["add"] = "POST",
            ["create"] = "POST",
            ["post"] = "POST",

            ["get"] = "GET",
            ["find"] = "GET",
            ["fetch"] = "GET",
            ["query"] = "GET",

            ["update"] = "PUT",
            ["put"] = "PUT",

            ["delete"] = "DELETE",
            ["remove"] = "DELETE",
        };
    }
}